<template>
  <div class="bodyDiv">
    <div class="data_main">
      <div class="t_line_box">
        <i class="t_l_line"></i>
        <i class="l_t_line"></i>
      </div>

      <div class="t_line_box">
        <i class="t_r_line"></i>
        <i class="r_t_line"></i>
      </div>

      <div class="t_line_box">
        <i class="l_b_line"></i>
        <i class="b_l_line"></i>
      </div>

      <div class="t_line_box">
        <i class="r_b_line"></i>
        <i class="b_r_line"></i>
      </div>
      <div class="main_title">
        <img src="../../../assets/visualization/action1/t_1.png" alt="" />
        上半年收入汇总
      </div>

      <div class="numDiv">
        <div class="numItem">
          <div class="numItemTile">当日</div>
          <div id="dayCounter" class="numItemValue">{{ dayValue }}</div>
        </div>
        <div class="numItem">
          <div class="numItemTile">当月</div>
          <div id="monthCounter" class="numItemValue">{{ monthValue }}</div>
        </div>
        <div class="numItem">
          <div class="numItemTile">今年</div>
          <div id="yearCounter" class="numItemValue">{{ yearValue }}</div>
        </div>
      </div>

      <div class="progressDiv">

        <div>
          <el-progress
            :percentage="70"
            :stroke-width="20"
            :text-inside="true"
            status="success"
            style="width: 100%; margin: 10px auto 0"
          />
          <div class="progressDiv_font">工作完成度：70%</div>
        </div>

        <div>
          <el-progress
            :percentage="55"
            :stroke-width="20"
            :text-inside="true"
            color="#EAA300"
            style="width: 100%; margin: 10px auto 0"
          />
          <div class="progressDiv_font">出勤率：55%</div>
        </div>

      

      </div>
    </div>
  </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import { CountUp } from "countup.js";

const dayValue = ref(0);
const monthValue = ref(0);
const yearValue = ref(0);

onMounted(() => {
  // 初始化CountUp实例
  const dayCounter = new CountUp("dayCounter", 1200, { duration: 2 });
  const monthCounter = new CountUp("monthCounter", 35120, { duration: 2 });
  const yearCounter = new CountUp("yearCounter", 5626982, { duration: 2.5 });

  setTimeout(() => {
    // 开始动画
    dayCounter.start();
    monthCounter.start();
    yearCounter.start();
  }, 3000);

  // 更新ref值
  dayValue.value = 1200;
  monthValue.value = 35120;
  yearValue.value = 5626982;
});
</script>
<style scoped>
.progressDiv{
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 80%;
  margin: 0 auto;
  margin-top: 20px;
}
.progressDiv_font{

}
.numItem {
}
.numDiv {
  display: flex;
  gap: 35px;
  justify-content: center;
  margin-top: 40px;
}
.numItemTile {
  font-size: 16px;
  text-align: center;
}
.numItemValue {
  font-size: 30px;
  text-align: center;
  color: #61d2f7;
  font-weight: bold;
  font-family: "SimHei", "黑体", sans-serif;
}

.bodyDiv {
  color: #fff;
  width: 100%;
  height: 100vh;
  position: relative;
}
.t_line_box {
  position: absolute;
  width: 100%;
  height: 100%;
}
.t_line_box i {
  background-color: #4788fb;
  box-shadow: 0px 0px 10px #4788fb;
  position: absolute;
}
.t_l_line {
  height: 5px;
  width: 26px;
  left: -3px;
  top: -3px;
}
.l_t_line {
  width: 5px;
  height: 24px;
  left: -3px;
  top: -3px;
}
.t_r_line {
  height: 5px;
  width: 26px;
  right: -3px;
  top: -3px;
}
.r_t_line {
  width: 5px;
  height: 24px;
  right: -3px;
  top: -3px;
}
.l_b_line {
  width: 5px;
  height: 24px;
  left: -3px;
  bottom: -3px;
}
.b_l_line {
  height: 5px;
  width: 26px;
  left: -3px;
  bottom: -3px;
}
.r_b_line {
  width: 5px;
  height: 24px;
  right: -3px;
  bottom: -3px;
}
.b_r_line {
  height: 5px;
  width: 26px;
  right: -3px;
  bottom: -3px;
}

.data_main {
  left: 20px;
  right: 20px;
  top: 20px;
  height: 260px;
  position: absolute;
  border: 1px solid #ccc;
}
.data_main .main_title img {
  position: absolute;
  top: 8px;
  left: 20px;
}
.data_main .main_title {
  width: 180px;
  height: 35px;
  line-height: 33px;
  background-color: #2c58a6;
  border-radius: 18px;
  position: absolute;
  top: -17px;
  left: 50%;
  margin-left: -90px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  box-sizing: border-box;
  padding-left: 45px;
}
</style>
